<%-------------------------------------------------------------------
 * 页面名称：queryHisList_content.jsp
 * 功能描述：历史交易查询
 * Action  : historyTransQuery.do
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%@ page import="cn.agiledata.bank.common.util.Constant"%>
<%@ page import="cn.agiledata.bank.account.service.IAccountConst"%>
<%@ page import="cn.agiledata.bank.account.service.AccountSummary"%>
<%
	String path = request.getContextPath();
	AccountSummary user = (AccountSummary) session
			.getAttribute(Constant.SESSION_ACCOUNT_SUMMARY);
%>
<script language="javascript" src="<%=path%>/js/popcalendar.js"></script>
<script language="javascript">
function id_keyup(txtinput){
    txtinput.value=txtinput.value.replace(/(^\s*)|(\s*$)/g, "");
}

function showOrderIdDiv(show){
    var orderIdDiv1 = document.getElementById("orderIdDiv1");
    orderIdDiv1.style.visibility = show?"visible":"hidden";
    var orderIdDiv2 = document.getElementById("orderIdDiv2");
    orderIdDiv2.style.visibility = show?"visible":"hidden";
    if(!show){
        document.forms[0].orderId.value = "";
    }
}

function searchIt(){
    var o = document.forms[0].all;
    for(var i=0;i<o.length;i++) {
        var dis = o[i].style.display;
        if(dis!="undefine"&&dis=="none"){
            o[i].style.display="block";
        }
        if(dis!="undefine"&&dis=="block"){
            o[i].style.display="none";
        }
    }
    if(document.forms[0].showAdvanced.value=="none")
        document.forms[0].showAdvanced.value="block";
    else 
        document.forms[0].showAdvanced.value="none";
}

function doSearch(){
    var beginDateObj = getObj('beginDate');
    if (beginDateObj.value!="") {
        if (!checkDateInput(beginDateObj)) {
            return;
        }
    }
    
    var endDateObj = getObj('endDate');
    if (endDateObj.value!="") {
        if (!checkDateInput(endDateObj)) {
            return;
        }
        if (beginDateObj.value!="") {
            if (compareDate(beginDateObj.value, endDateObj.value)<0) {
                alert("起始日期不能大于结束日期！");
                return;
            }
        }
    }
    
    var amountMin = getObj('amountMin').value;
    var amountMax = getObj('amountMax').value;
    if(isNaN(amountMin)==true){
        alert("请输入数字！");
        getObj('amountMin').focus();
        getObj('amountMin').value="";
        return;
    }
    if(isNaN(amountMax)==true){
        alert("请输入数字！");
        getObj('amountMax').focus();
        getObj('amountMax').value="";
        return;
    }
    
    document.forms["0"].submit();
}
</script>
<html:form action="historyTransQuery.do" method="post">
	<html:hidden property="showAdvanced" />
	<div id="main">
		<div class="content_right">
			<div style="width:745px;margin-left:10px;">
				<div class="titleinfo">
					<span class="bluefont18bdrop">历史交易查询</span>
				</div>
				<div class="edit_pass">
					<table width="100%" border="0" align="center" cellpadding="3"
						cellspacing="1">
						<tr>
							<td width="18%" align="right" class="font_blue">
								请选择账户名称：
							</td>
							<td width="30%" bgcolor="#FFFFFF">
								<html:select style="WIDTH: 133px" property="subAccountID">
									<html:option value="">所有账户</html:option>
									<html:optionsCollection name="account" property="subAccounts"
										label="accountName" value="id" />
								</html:select>
							</td>
							<td width="17%" align="right" class="font_blue">
								交易类型：
							</td>
							<td width="35%" bgcolor="#FFFFFF">
								<html:select property="actionTypeID">
									<%
												if (IAccountConst.COMPANY_TYPE_GATEWAY
												.equals(user.getCompanyType())) {
									%>
									<html:option value="">所有交易类型</html:option>
									<html:options collection="ACTION_TYPE" property="value"
										labelProperty="label" />
									<%
												} else if (IAccountConst.COMPANY_TYPE_SIMPLE.equals(user
												.getCompanyType())) {
									%>
									<ad:agileOptions typeid="ACTION_TYPE" dummyLabel="所有交易类型" />
									<%
									} else {
									%>
									<html:option value="">所有交易类型</html:option>
									<html:options collection="ACTION_TYPE_PERSONAL"
										property="value" labelProperty="label" />
									<%
									}
									%>
								</html:select>
							</td>
						</tr>
						<tr>
							<td align="right" class="font_blue">
								交易状态：
							</td>
							<td bgcolor="#FFFFFF">
								<html:select property="transStatusID">
									<ad:agileOptions typeid="TRANS_STATUS" dummyLabel="所有的交易状态" />
								</html:select>
							</td>
							<td align="right" class="font_blue">
								交易日期：
							</td>
							<td bgcolor="#FFFFFF">
								<ad:calendar property="beginDate" path="<%=path%>" />
								至
								<ad:calendar property="endDate" path="<%=path%>" />
							</td>
						</tr>
						<tr>
							<td align="right" class="font_blue">
								显示收/付款：
							</td>
							<td bgcolor="#FFFFFF">
								<html:select size="1" property="amountView">
									<html:option value="">所有收/付款</html:option>
									<html:option value="1">只显示收款</html:option>
									<html:option value="0">只显示付款</html:option>
								</html:select>
							</td>
							<td align="right" class="font_blue">
								交易金额：
							</td>
							<td bgcolor="#FFFFFF">
								<span class="qzt"> <html:text styleClass="inputStyle"
										size="8" property="amountMin" onkeyup="id_keyup(this)" /> 至 <html:text
										styleClass="inputStyle" size="8" property="amountMax"
										onkeyup="id_keyup(this)" /> </span>
							</td>
						</tr>
						<tr id="tradeemail_dis"
							style="DISPLAY: <bean:write name="AccountQueryBean" property="showAdvanced"/>">
							<td align="right" class="font_blue">
								交易对方：
							</td>
							<td bgcolor="#FFFFFF">
								<html:text styleClass="inputStyle" property="otherAccountID"
									onkeyup="id_keyup(this)" />
							</td>
							<td align="right" class="font_blue">
								交易编号：
							</td>
							<td bgcolor="#FFFFFF">
								<html:text styleClass="inputStyle" property="transId"
									onkeyup="id_keyup(this)" />
							</td>
						</tr>
						<logic:equal name="sessionAccountSummary"
							property="user.accountType" value="B">
							<tr id="tradeemail_dis"
								style="DISPLAY: <bean:write name="AccountQueryBean" property="showAdvanced"/>">
								<td align="right" class="font_blue">
									显示订单编号：
								</td>
								<td bgcolor="#FFFFFF">
									<html:radio property="showOrderId" value="false"
										onclick="showOrderIdDiv(false);" />
									否
									<html:radio property="showOrderId" value="true"
										onclick="showOrderIdDiv(true);" />
									是
								</td>
								<td align="right" class="font_blue">
									<div id="orderIdDiv1" style="visibility: hidden;">
										订单编号：
									</div>
								</td>
								<td bgcolor="#FFFFFF">
									<div id="orderIdDiv2" style="visibility: hidden;">
										<html:text styleClass="inputStyle" property="orderId"
											onkeyup="id_keyup(this)" />
									</div>
								</td>
								<script language="javascript">showOrderIdDiv(<bean:write name="AccountQueryBean" property="showOrderId"/>);</script>
							</tr>
						</logic:equal>
						<tr>
							<td colspan="4" align="right">
								<hr size="1" style="color:#88A7C0;" />
							</td>
						</tr>
						<tr>
							<td colspan="4" align="center" bgcolor="#FFFFFF">
								<span class="button_Frame"> <input type="button"
										value="查 询" class="graybutton_style" onclick="doSearch()"
										style="margin-right:10px;" />
								</span>
							</td>
						</tr>
						<tr>
							<td colspan="4" bgcolor="#FFFFFF">
								<table width="100%" class="tablestyle">
									<tr>
										<logic:equal name="AccountQueryBean" property="showOrderId"
											value="true">
											<th>
												<span class="blue14">订单编号</span>
											</td>
										</logic:equal>
										<th>
											<span class="blue14">交易编号</span>
										</td>
										<th>
											<span class="blue14">交易对方</span>
										</td>
										<th>
											<span class="blue14">交易类型</span>
										</td>
										<th>
											<span class="blue14">交易模式</span>
										</td>
										<th>
											<span class="blue14">交易状态</span>
										</td>
										<th>
											<span class="blue14">交易时间</span>
										</td>
										<th>
											<span class="blue14">收/付</span>
										</td>
										<th>
											<span class="blue14">金额</span>
										</td>
										<th>
											<span class="blue14">费用</span>
										</td>
									</tr>
									<c:forEach var="aqb" items="${pagination.data}"
										varStatus="status">
										<c:if test="${status.index % 2 == 0}">
											<tr>
										</c:if>
										<c:if test="${status.index % 2 == 1}">
											<tr>
										</c:if>
										<logic:equal name="AccountQueryBean" property="showOrderId"
											value="true">
											<td>
												<bean:write name="aqb" property="orderId" />
											</td>
										</logic:equal>
										<td>
											<a
												href="<%=path%>/page/transaction/accountHisQueryDetail.do?transactionID=<bean:write name="aqb" property="tid"/>"><bean:write
													name="aqb" property="transId" /> </a>
										</td>
										<td>
											<logic:equal name="aqb" property="actionType"
												value="账户间交易">
												<a
													href="<%=path%>/page/common/getAccount.do?accountId=<bean:write name="aqb" property="otherAccountId"/>"><bean:write
														name="aqb" property="otherAccount" /> </a>
											</logic:equal>
											<logic:notEqual name="aqb" property="actionType"
												value="账户间交易">
												<bean:write name="aqb" property="otherAccount" />
											</logic:notEqual>
										</td>
										<td>
											<bean:write name="aqb" property="actionType" />
										</td>
										<td>
											<ad:write typeid="TRADE_TYPE" name="aqb"
												property="tradeType" />
										</td>
										<td>
											<ad:write typeid="TRANS_STATUS" name="aqb"
												property="transStatus" />
										</td>
										<td>
											<bean:write name="aqb" format="yyyy-MM-dd HH:mm:ss"
												property="date" />
										</td>
										<td>
											<bean:write name="aqb" property="payMode" />
										</td>
										<td>
											<bean:write name="aqb" property="amount" />
											元
										</td>
										<td>
											<bean:write name="aqb" property="fee" />
											元
										</td>
										</tr>
									</c:forEach>
								</table>
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td class="font_blue">
											<ad:PageBean name="pagination" />
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
	</div>

</html:form>
